package com.fun.feifun.modules.business.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fun.feifun.modules.business.model.BusinessAmountRecord;
import com.fun.feifun.modules.business.dao.BusinessAmountRecordMapper;
import com.fun.feifun.modules.business.model.dto.BusinessAmountRecordDto;
import com.fun.feifun.modules.business.model.param.BusinessAmountRecordPage;
import com.fun.feifun.modules.business.service.IBusinessAmountRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 金额历史记录 服务实现类
 * </p>
 *
 * @author wkf
 * @since 2024-05-29
 */
@Service
public class BusinessAmountRecordServiceImpl extends ServiceImpl<BusinessAmountRecordMapper, BusinessAmountRecord> implements IBusinessAmountRecordService {


    @Override
    public Page<BusinessAmountRecordDto> getDtoPage(BusinessAmountRecordPage page) {
        Page<BusinessAmountRecordDto> rePage = new Page(page.getPage(),page.getSize());
        Integer count = baseMapper.selectDtoCount(page);
        int size = page.getSize();
        int pageNum =  (page.getPage()-1)* size;
        List<BusinessAmountRecordDto> list = baseMapper.selectDtoList(page,size,pageNum);
        rePage.setRecords(list);
        rePage.setTotal(1);
        rePage.setTotal(count);
        return rePage;
    }
}
